/* Stats Shortcode Styling */

/* Base stats component */
.wiki-stats {
    border-radius: 6px;
    padding: 12px;
    margin: 10px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    background-color: #f5f5f5;
    color: #333333;
}

/* Dark theme base */
:root[data-theme="dark"] .wiki-stats {
    background-color: #2a2e33;
    color: #e0e0e0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* When multiple stats components are placed consecutively */
.wiki-stats + .wiki-stats {
    margin-top: 8px;
}

/* Stats headers */
.wiki-stats h4 {
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    padding-bottom: 4px;
    color: #333;
    border-bottom: 1px solid #ddd;
}

:root[data-theme="dark"] .wiki-stats h4 {
    color: #ffffff;
    border-bottom: 1px solid #3e464f;
}

/* Document Count stats */
.wiki-stats.doc-count {
    text-align: center;
}

.wiki-stats .count-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.wiki-stats .count-number {
    font-size: 3rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 4px;
    color: #2196f3;
}

:root[data-theme="dark"] .wiki-stats .count-number {
    color: #64b5f6;
}

.wiki-stats .count-description {
    font-size: 0.85rem;
    color: #666;
}

:root[data-theme="dark"] .wiki-stats .count-description {
    color: #b0bec5;
}

/* Recent Edits stats */
.wiki-stats.recent-edits ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.wiki-stats.recent-edits li {
    padding: 4px 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 4px;
    border-bottom: 1px solid #e0e0e0;
}

:root[data-theme="dark"] .wiki-stats.recent-edits li {
    border-bottom: 1px solid #3e464f;
}

.wiki-stats.recent-edits li:last-child {
    border-bottom: none;
}

.wiki-stats.recent-edits .doc-info {
    display: flex;
    flex: 1;
    overflow: hidden;
    align-items: baseline;
    gap: 8px;
    min-width: 0; /* Allows text truncation to work */
    max-width: calc(100% - 80px); /* Adjust based on date width */
}

/* Common styles for small text elements */
.wiki-stats.recent-edits .doc-path,
.wiki-stats.recent-edits .edit-date {
    white-space: nowrap;
    font-size: 0.8rem;
}

.wiki-stats.recent-edits .doc-path {
    overflow: hidden;
    text-overflow: ellipsis;
    color: #757575;
    flex: 1;
    text-align: left;
    padding-left: 4px;
    min-width: 50px;
}

.wiki-stats.recent-edits .edit-date {
    color: #757575;
}

:root[data-theme="dark"] .wiki-stats.recent-edits .doc-path {
    color: #9e9e9e;
}

:root[data-theme="dark"] .wiki-stats.recent-edits .edit-date {
    color: #b0bec5;
}

/* Links in stats components */
.wiki-stats.recent-edits a {
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #2196f3;
    max-width: 100%;
    flex-shrink: 0;
}

:root[data-theme="dark"] .wiki-stats.recent-edits a {
    color: #64b5f6;
}

.wiki-stats.recent-edits a:hover {
    text-decoration: underline;
}

/* Error message for invalid stats */
.wiki-stats-error {
    border-left: 4px solid #f44336;
    padding: 8px 12px;
    margin: 8px 0;
    font-style: italic;
    background-color: #ffebee;
    color: #d32f2f;
}

:root[data-theme="dark"] .wiki-stats-error {
    background-color: #2a2e33;
    color: #f44336;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .wiki-stats {
        padding: 10px;
    }

    .wiki-stats .count-number {
        font-size: 2.5rem;
    }

    .wiki-stats.recent-edits .doc-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
        max-width: 100%;
    }

    .wiki-stats.recent-edits .doc-path {
        width: 100%;
    }
}